package com.wise.site.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.wise.site.R;
import com.wise.site.detail.SupplyDetailsActivity;
import com.wise.site.utils.Constanct;
import com.wise.site.utils.ImageLoader;
import com.wise.site.utils.ImageLoader.Imager;

public class SupplyImageAdapter extends BaseAdapter{
	
	private Context mContext;
	private LayoutInflater inflater;
	
	public SupplyImageAdapter(Context context){
		this.mContext = context;
		inflater = LayoutInflater.from(context);
	}
	
	public List<String> imageList;// = new imagel

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return imageList.size();
	}

	@Override
	public String getItem(int location) {
		// TODO Auto-generated method stub
		return imageList.get(location);
	}

	@Override
	public long getItemId(int location) {
		// TODO Auto-generated method stub
		return location;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View v = inflater.inflate(R.layout.image_layout, null);
		
		ImageView imageView = (ImageView) v.findViewById(R.id.image);
		ImageLoader.getInstance().DisplayImage(new Imager(Constanct.IMAGE_PREFIX + imageList.get(position), imageView, mContext.getResources().getDimensionPixelSize(R.dimen.mult_ima_height), 0));
		//imageView.setImageResource(Integer.parseInt(imageList.get(position)));
		return v;
	}
	
	public void setList(List<String> imageList){
		this.imageList = imageList;
	}
	
}